package hong.jun.controller;

import hong.jun.domain.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserTestcontroller {

    @Value("${server.port}")
    private int port;//获取运行时yml里的端口

    @GetMapping(value = "/user1/{id}")
    public User touser (@PathVariable("id")long id){
        User user = new User(id, String.valueOf(port));
        System.out.println("user1------"+user);
        return user;
    }
}
